<!DOCTYPE html>
<html>
<head>
    <title>编辑商品:商品类型</title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <Row :gutter="16">
            <div class="search-group">
                <i-col span="4">
                    <i-input v-model="q.name" @on-enter="query" placeholder="名称"/>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
            <div class="buttons-group">
                #if($shiro.hasPermission("category:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end
                #if($shiro.hasPermission("category:update"))
                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                #end
                #if($shiro.hasPermission("category:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="proCategory" :rules="ruleValidate" :label-width="120">
            <Form-item label="分类名称" prop="name">
                <i-input v-model="proCategory.name" placeholder="分类名称"/>
            </Form-item>

            <Form-item label="上级分类" prop="parentId">
                <i-select v-model="proCategory.parentId" placeholder="上级分类">
                    <i-option :value="0">一级分类</i-option>
                    <i-option :value="cate.id" v-for="cate in categorysL1">{{cate.name}}</i-option>
                </i-select>
            </Form-item>
            
            <Form-item label="排序值" prop="sortOrder">
                <i-input v-model="proCategory.sortOrder" placeholder="排序值"/>
            </Form-item>
            <Row>
                <i-col span="16">
                    <Form-item label="图片地址" prop="imageUrl">
                        <i-input v-model="proCategory.imageUrl" placeholder="图片地址" readonly/>
                    </Form-item>
                </i-col>
                <i-col span="3">
                    <Form-item :label-width="1">
                        <Upload style="width: 300px;" action="../sys/oss/upload?prefix=procategory"
                                :format="['jpg','jpeg','png']"
                                max-size="2048"
                                :on-success="handleSuccessImageUrl" :on-format-error="handleFormatError"
                                :show-upload-list="false"
                                :on-exceeded-size="handleMaxSize">
                            <i-button icon="ios-cloud-upload-outline">上传图片</i-button>
                        </Upload>
                    </Form-item>
                </i-col>
                <i-col span="3">
                    <Form-item :label-width="1">
                        <i-button icon="eye" @click="eyeImageUrl">预览图片</i-button>
                    </Form-item>
                </i-col>
            </Row>

            <Form-item label="服务费" prop="rate">
                <Input-number :min="0" v-model="proCategory.rate" placeholder="手续费"/>
            </Form-item>
            <Form-item label="赠送能量利率" prop="energyRate">
                <Input-number :min="0" v-model="proCategory.energyRate" placeholder="赠送能量利率"/>
            </Form-item>
            <Form-item label="释放能量费率" prop="spcFree">
                <Input-number :min="0" v-model="proCategory.spcFree" placeholder="释放能量费率"/>
            </Form-item>
            <Form-item label="团队赠送" prop="gaveTeam">
                <Input-number :min="0" v-model="proCategory.gaveTeam" placeholder="团队赠送"/>
            </Form-item>
            <Form-item label="描述" prop="frontDesc">
                <i-input v-model="proCategory.frontDesc" placeholder="描述"/>
            </Form-item>
            <Form-item label="是否显示" prop="show">
                <i-switch v-model="proCategory.show">
                    <span slot="1">是</span>
                    <span slot="0">否</span>
                </i-switch>
            </Form-item>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
</div>

<script src="${rc.contextPath}/js/product/procategory.js?_${date.systemTime}"></script>
</body>
</html>
